--- import translate from '$i18n/translate'; import tPage from '$i18n/translations/pages/news'; import Page from '$layouts/Page.astro'; import getLocaleFromPath from '$lib/getLocaleFromPath'; import localeStaticPaths from '$lib/localeStaticPaths'; import { getCollection } from 'astro:content'; import NewsPreviewLink from '$components/NewsPreviewLink.astro'; const allNews = await getCollection('news'); const locale = getLocaleFromPath(Astro.url.pathname); const allNewsInLocale = allNews.filter(isInLocale); const t = translate(locale); function isInLocale(newsItem: (typeof allNews)[number]) { const srcPath = newsItem.id; const newsItemLocale = srcPath.slice(0, srcPath.indexOf('/')); return newsItemLocale === locale; } export async function getStaticPaths() { return localeStaticPaths; } ---

{t(tPage, { key: 'title' })}

{ allNewsInLocale.length > 0 ? ( allNewsInLocale.map((item) => ) ) : (

{t(tPage, { key: 'no-news' })}

) }